import {encryptWithCompress} from "@/utils/AESCRUDUtils";

/**
 *
 * @param url
 * @param params
 * @param returnDataOnly boolean类型  只返回数据
 * @returns {Promise<unknown>}
 */
export const get = (http, url, params, returnDataOnly, isParams) => {
    return http.get(url, params, returnDataOnly, isParams);
}
export const post = (http, url, params, autoMessage, returnStatus) => {
    return http.post(url, params, autoMessage, returnStatus);
}
export const postAes = (http, url, params, autoMessage, returnStatus) => {
    return http.post(url, encryptWithCompress(params), autoMessage, returnStatus);
}
export const request = (http, config, autoMessage, returnStatus) => {
    return http.request(config, autoMessage, returnStatus);
}
export const postQs = (http, url, params, autoMessage, returnStatus) => {
    return http.postQs(url, params, autoMessage, returnStatus)
}

export const put = (http, url, params, autoMessage, returnStatus) => {
    return http.put(url, params, autoMessage, returnStatus)
}

export const del = (http, url, params, autoMessage, returnStatus) => {
    return http.del(url, params, autoMessage, returnStatus)
}
export const upload = (http, url, params, onUploadProgress) => {
    return http.upload(url, params, onUploadProgress)
}
export default {
    get, post, put, del, postQs, request
}
